<?php

?>
<form id="calcForm" action="" method="GET">
<script>
var F = $('#calcForm').get(0);

function Calculator()
{
	this.press = function(key)
	{
		if (F.elements['data'].value == '0') {
			F.elements['data'].value = key;
		} else if (F.elements['data'].value.length < 8) {
			F.elements['data'].value = F.elements['data'].value + key;
		}
	}
}

var calc = new Calculator();

</script>
<table style="margin: 10em;">
<tr>
<td colspan="2" style="text-align: right;">
<input type="text" name="data" value="<?php echo $o->getValue(); ?>" />
</td>

</tr><tr>
<td style="vertical-align: top;">
<fieldset><legend>Memory</legend>
<input type="submit" value="C" onclick="F.elements['action'].value = 'memoryCencel'; F.submit();" />
<input type="submit" value="R" onclick="F.elements['action'].value = 'memoryRead'; F.submit();" />
<br />
<input type="submit" value="−" onclick="F.elements['action'].value = 'subFromMemory'; F.submit();" />
<input type="submit" value="+" onclick="F.elements['action'].value = 'addToMemory'; F.submit();" />
<br />
<input type="submit" value="U" onclick="F.elements['action'].value = 'memoryU'; F.submit();" />
</fieldset>
</td>
<td><fieldset><legend>Operations</legend>
<input type="submit" value="×" onclick="F.elements['action'].value = 'oprMultiply'; F.submit();" />
<input type="submit" value="÷" onclick="F.elements['action'].value = 'oprDivide'; F.submit();" />
<input type="submit" value="+" onclick="F.elements['action'].value = 'oprAdd'; F.submit();" />
<input type="submit" value="−" onclick="F.elements['action'].value = 'oprSubstraction'; F.submit();" />
<br />
<input type="submit" value="√" onclick="F.elements['action'].value = 'sqrt'; F.submit();" />
<input type="submit" value="%" onclick="F.elements['action'].value = 'percent'; F.submit();" />
<input type="submit" value="±" onclick="var t = F.elements['data']; t.value = parseInt(t.value)*-1; return false;" />
<input type="submit" value="=" onclick="F.elements['action'].value = 'assign'; F.submit();" />
</fieldset>
<fieldset><legend>Keys</legend>
<input type="submit" value="7" onclick="calc.press('7'); return false;" />
<input type="submit" value="8" onclick="calc.press('8'); return false;" />
<input type="submit" value="9" onclick="calc.press('9'); return false;" />
<br />
<input type="submit" value="4" onclick="calc.press('4'); return false;" />
<input type="submit" value="5" onclick="calc.press('5'); return false;" />
<input type="submit" value="6" onclick="calc.press('6'); return false;" />
<br />
<input type="submit" value="1" onclick="calc.press('1'); return false;" />
<input type="submit" value="2" onclick="calc.press('2'); return false;" />
<input type="submit" value="3" onclick="calc.press('3'); return false;" />
<br />
<input type="submit" value="0" onclick="calc.press('0'); return false;" />
<input type="submit" value="." onclick="calc.press('.'); return false;" />
</fieldset></td>
</tr></table>
<input type="hidden" name="action" value="" />

</form>